module.exports = async (req, res) => {
  // res.send('ok');
  const mongoose = require('mongoose');
  const Category = require('../../models/Category');
  const id = req.params.id;
 if(id){ //修改
  const model = await Category.findById(id);
  res.send(model);

 }else {  //增加
    //获取用户的请求参数，数据库中创建新分类数据
  const model = await Category.create(req.body);
  res.send(model);
 }
}
